#ifndef _CBASEOBJECT_H_20120501__
#define _CBASEOBJECT_H_20120501__

#include <map>
#include <Ogre.h>
#include <btBulletDynamicsCommon.h>
#include "../src/ErrorOutputs.h"
#include "../src/DataConvertion.h"



class BaseObject : public btMotionState
{
public:
        enum Type
        {
            TYPE_NONE,
            /**
              TYPE_FLOOR contains: material, sizeX, sizeY, elementsX, elementsY, meshName
              */
            TYPE_FLOOR,
            /**
              TYPE_SPHERE contains: material, radius, mass
              */
            TYPE_SPHERE,
            /**
              TYPE_SPHERE contains: material, sidelenght, mass
              */
            TYPE_CUBE,
            /**
              TYPE_LIGHT contains: color
              */
            TYPE_LIGHT
        };

        BaseObject(void);
        ~BaseObject(void);

        // basic types
        void setPosition(float x, float y, float z);
        void getPosition(float *x, float *y, float *z);
        void setDirection(float x, float y, float z);
        void getDirection(float *x, float *y, float *z);
        void setProperty(std::string propertyName, std::string propertyValue);
        std::string getProperty(std::string propertyName);
        void setType(BaseObject::Type type);
        BaseObject::Type getType();
        bool isControlable();
        void setControlable(bool isControlable);
        bool isPhysicsRelevant();
        void isPhysicsRelevant(bool isRelevant);
        bool isGraphicsRelevant();
        void isGraphicsRelevant(bool isRelevant);


        // Ogre types
	Ogre::SceneNode *getSceneNode(void);
	void setSceneNode(Ogre::SceneNode *SceneNode);
        void movableObject(Ogre::MovableObject *object);
        Ogre::MovableObject *movableObject();

        // bullet types
        void setCollisionShape(btCollisionShape *collisionShape);
        btCollisionShape *getCollisionShape();
        void setRigidBody(btRigidBody *rigidBody);
        btRigidBody *getRigidBody();

        // btMotionState:
        void getWorldTransform(btTransform &worldTrans) const;
        void setWorldTransform(const btTransform &worldTrans);

private:

protected:
        Ogre::SceneNode *m_sceneNode;
        Ogre::MovableObject *m_movableObject;
        btTransform m_Transform;
        btCollisionShape *m_collisionShape;
        btRigidBody *m_rigidBody;
        std::map<std::string, std::string> m_propertyMap;
        BaseObject::Type m_Type;
        bool m_controlable;
        bool m_isPhysicsRelevant;
        bool m_isGraphicsRelevant;
};

#endif // _CBASEOBJECT_H_20120501__
